
#include "stdafx.h"
#include "ConsoleOutput.h"

#ifndef STD_PRINTF
void ConsoleOutput( const char* fmt,... )
{
	
	va_list ap;
	va_start( ap,fmt );
	vsprintf( __print_buf,fmt,ap );
	va_end( ap );

	SETTEXTEX stex;
	stex.codepage = 936;
	stex.flags = ST_DEFAULT|ST_SELECTION;

	int L = ::GetWindowTextLength( __hConsoleWnd );
	::SendMessage( __hConsoleWnd,EM_SETSEL,L,L);
	int r = ::SendMessage( __hConsoleWnd,EM_SETTEXTEX,(WPARAM)&stex,(LPARAM)__print_buf );
}
#endif
